#pragma once

class CNeuronBase;

typedef std::vector< CNeuronBase* > NeuronV;

/*----------------------------------------------------------------------------*/

class CLayer
{
/*----------------------------------------------------------------------------*/

public:

/*----------------------------------------------------------------------------*/

	CLayer( int _inputsNum, int _neuronsNum, bool _isLast = false );

	CLayer( std::ifstream& _file, bool _isLast = false );

	virtual ~CLayer();												
	
/*----------------------------------------------------------------------------*/

	void CalcLocalErrors( const DoubleV& _data );

	int GetNeuronsNum();

	void CalculateOutputValues( const DoubleV& _inputValues );	

	const DoubleV& GetResultValues() const;

	const DoubleV& GetBackErrors() const;

	void CalcNewWeights( double _speed, const DoubleV& _inputValues );

	void SaveToFile( std::ofstream& _file );

/*----------------------------------------------------------------------------*/

	// temp
	void PrintNeuroWeights();
	void PrintNeuroOutputs();
	void PrintError();
	void PrintWeError();
	void PrintBackError();

/*----------------------------------------------------------------------------*/

private:

/*----------------------------------------------------------------------------*/

	int		m_inputsNum;
	DoubleV m_resultValues;
	DoubleV m_backErrors;
	NeuronV m_neurons;		

/*----------------------------------------------------------------------------*/

	void CalcBackErrors();

/*----------------------------------------------------------------------------*/

};

/*----------------------------------------------------------------------------*/
